Once your packetizer is initialized, it will receive several calls to set the information it needs prior to packetizing data, such as the media timescale. You may also be called with requests to return the settings you have been given. The main set up functions are listed below:
RTPMPSetTimeScale
RTPMPGetTimeScale
RTPMPSetPacketBuilder
RTPMPGetPacketBuilder
RTPMPSetMediaType
RTPMPGetMediaType
RTPMPSetMaxPacketSize
RTPMPGetMaxPacketSize
RTPMPSetMaxPacketDuration
RTPMPGetMaxPacketDuration
The Set functions listed above are used to set the time scale, packet builder (which receives your output), media type, maximum packet size, and maximum packet duration. These functions will be called before you are asked to begin packetizing data, and will not be called after you have begun packetizing data.
The Get functions listed above can be called at any time. When your packetizer is called with one of these Get functions, return the data that was passed to you in the corresponding Set function.
RTPMPSetTimeBase RTPMPGetTimeBase
The time base functions may be called for live transmission. The Set function sets the QuickTime time base that is in use. Your packetizer can query this time base to find out what time it is in the live stream. Your packetizer should not rely on receiving this call.
RTPMPHasCharacteristic may be called to determine whether your media packetizer has a particular characteristic, such as whether it supports a user settings dialog. Return qtsBadSelectorErr if your packetizer does not have the given characteristic.
ComponentResult RTPMPHasCharacteristic (
RTPMediaPacketizer rtpm,
OSType inSelector,
Boolean *outHasIt);
If your packetizer supports a user dialog or additional settings, you may also receive dialog or settings calls as part of the set up process:
RTPMPDoUserDialog
RTPMPSetSettingsFromAtomContainerAtAtom
RTPMPGetSettingsIntoAtomContainerAtAtom
RTPMPGetSettingsAsText
The RTPMPDoUserDialog function will invoke your packetizer's modal dialog to obtain user settings.
The RTPMPGetSettingsIntoAtomContainerAtAtom function expects you to return those settings into an atom container at the specified offset.
The RTPMPSetSettingsFromAtomContainerAtAtom function is used to set the user settings programmatically, bypassing the user dialog.
The RTPMPGetSettingsAsText function expects you to return your user settings as text.
In addition to the set up calls listed above, you may receive RTPMPSetInfo function calls. These are used to send a variety of information to your packetizer, as indicated by the selector. If you don't support a given selector, return qtsBadSelectorErr .
RTPMPSetInfo selectors can be:
kQTSSourceTrackIDInfo ('otid'),/* UInt32* */
kQTSSourceLayerInfo ('olyr'),/* UInt16* */
kQTSSourceLanguageInfo ('olng'),/* UInt16* */
kQTSSourceTrackFlagsInfo ('otfl'),/* SInt32* */
kQTSSourceDimensionsInfo ('odim'),/* QTSDimensionParams* */
kQTSSourceVolumesInfo ('ovol'),/* QTSVolumesParams* */
kQTSSourceMatrixInfo ('omat'),/* MatrixRecord* */
kQTSSourceClipRectInfo ('oclp'),/* Rect* */
kQTSSourceGraphicsModeInfo ('ogrm'),/* QTSGraphicsModeParams* */
kQTSSourceScaleInfo ('oscl'),/* Point* */
kQTSSourceBoundingRectInfo ('orct'),/* Rect* */
kQTSSourceUserDataInfo ('oudt'),/* UserData */
kQTSSourceInputMapInfo ('oimp'),/* QTAtomContainer */
Your packetizer can be called with these selectors even if it indicated that it couldn't handle the given characteristic in its 'pcki' resource. In that case, return qtsBadSelectorErr .
Your packetizer may receive the related RTPMPGetInfo function at any time:
pascal ComponentResult RTPMPGetInfo(RTPMediaPacketizer rtpm,
OSType inSelector, void *ioParams);
Your packetizer is expected to return the requested information in ioParams . The type of ioParams is dependent on inSelector . If you don't support the selector, return qtsBadSelectorErr . The selectors can be any of the selectors for RTPMPSetInfo or any of the additional selectors listed below:
/* info selectors - get only */
kRTPMPPayloadTypeInfo ('rtpp'),/* RTPMPPayloadTypeParams* */
kRTPMPRTPTimeScaleInfo ('rtpt'),/* TimeScale* */
kRTPMPRequiredSampleDescriptionInfo ('sdsc'), /* SampleDescriptionHandle* */
kRTPMPMinPayloadSize ('mins'),/* UInt32*, doesn't include rtp header; default 0 */
kRTPMPMinPacketDuration ('mind'), /* UInt3* in milliseconds; default is no min */
kRTPMPSuggestedRepeatPktCountInfo ('srpc'),/* UInt32* */
kRTPMPSuggestedRepeatPktSpacingInfo ('srps'), /* UInt32* in milliseconds */
kRTPMPMaxPartialSampleSizeInfo ('mpss'),/* UInt32* in bytes */
kRTPMPPreferredBufferDelayInfo ('prbd') /* UInt32* in milliseconds */
The kRTPMPPayloadTypeInfo selector requires you to fill out an RTPMPPayloadTypeParams structure.
/* flags for RTPMPPayloadTypeParams */
enum {
kRTPMPPayloadTypeStaticFlag= 0x00000001,
kRTPMPPayloadTypeDynamicFlag = 0x00000002
};
struct RTPMPPayloadTypeParams {
UInt32 flags;
UInt32 payloadNumber;
short nameLength;
/* in: size of payloadName buffer (counting null terminator)
/* -- this will be reset to needed length and paramErr returned if too small */
char * payloadName; /* caller must provide buffer */
};
typedef struct RTPMPPayloadTypeParams RTPMPPayloadTypeParams;
If you have a dynamic RTP payload type, you need to copy the payload type string to the buffer pointed to by payloadName (a null-terminated string). When RTPMPGetInfo is called, RTPMPPayloadTypeParams.nameLength will be the available size of the input buffer (specified by payloadName ). If this size is too small for the payload identifier, set nameLength to the size of the buffer you need (including the null terminator) and return paramErr . This will cause QuickTime to reallocate the buffer and call your packetizer again.
| Previous | Chapter Contents | Chapter Top | Next |